<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>id函数</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: pink;
            margin: 20px;
            display: none;
        }
    </style>
</head>
<body>
<div id="demo">1</div>
<div id="test">2</div>
</body>
<script>
    function $(id){
        return document.getElementById(id);
    }
    $("demo").style.display = "block";
    $("test").style.display = "block";
</script>
</html>